//
//  UserCell.m
//  SheShiDu
//
//  Created by 泉  姜 on 16/6/17.
//  Copyright © 2016年 单剑秋. All rights reserved.
//

#import "UserCell.h"

#define HEIGHT self.contentView.frame.size.height
#define WIDTH self.contentView.frame.size.width
@implementation UserCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backgroundImgView = [[UIImageView alloc] init];
        _backgroundImgView.backgroundColor = [UIColor cyanColor];
        [self.contentView addSubview:_backgroundImgView];
        
        UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
        self.effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
        [_backgroundImgView addSubview:_effectView];
        
        self.messageButton = [UIButton buttonWithType:UIButtonTypeCustom];
//        _messageButton.backgroundColor = [UIColor redColor];
        [_backgroundImgView addSubview:_messageButton];
        
        self.userButton = [UIButton buttonWithType:UIButtonTypeCustom];
//        _userButton.backgroundColor = [UIColor redColor];
        [_backgroundImgView addSubview:_userButton];
        
        self.setUpButton = [UIButton buttonWithType:UIButtonTypeCustom];
//        _setUpButton.backgroundColor = [UIColor redColor];
        [_backgroundImgView addSubview:_setUpButton];
        
        self.telephoneLabel = [[UILabel alloc] init];
//        _telephoneLabel.backgroundColor = [UIColor yellowColor];
        _telephoneLabel.font = [UIFont systemFontOfSize:21];
        _telephoneLabel.textColor = [UIColor whiteColor];
        [_backgroundImgView addSubview:_telephoneLabel];
        
        self.positionImgView = [[UIImageView alloc] init];
//        _positionImgView.backgroundColor = [UIColor redColor];
        [_backgroundImgView addSubview:_positionImgView];
        
        self.positionLabel = [[UILabel alloc] init];
//        _positionLabel.backgroundColor = [UIColor redColor];
        _positionLabel.textColor = [UIColor whiteColor];
        _positionLabel.font = [UIFont systemFontOfSize:15];
        [_backgroundImgView addSubview:_positionLabel];
        
        self.lineLabel = [[UILabel alloc] init];
        _lineLabel.backgroundColor = [UIColor whiteColor];
        [_backgroundImgView addSubview:_lineLabel];
        
        self.lineLabel2 = [[UILabel alloc] init];
        _lineLabel2.backgroundColor = [UIColor whiteColor];
        [_backgroundImgView addSubview:_lineLabel2];
        
        self.lineLabel3 = [[UILabel alloc] init];
        _lineLabel3.backgroundColor = [UIColor whiteColor];
        [_backgroundImgView addSubview:_lineLabel3];
        
        self.orderButton = [QButton buttonWithType:UIButtonTypeCustom];
        [_backgroundImgView addSubview:_orderButton];
        
        self.livingButton = [QButton buttonWithType:UIButtonTypeCustom];
        [_backgroundImgView addSubview:_livingButton];
        
        self.renovateButton = [QButton buttonWithType:UIButtonTypeCustom];
        [_backgroundImgView addSubview:_renovateButton];
    }
    return self;
}

- (void)layoutSubviews
{
    _backgroundImgView.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
    _effectView.frame = CGRectMake(0, 0, _backgroundImgView.frame.size.width, _backgroundImgView.frame.size.height);
    _messageButton.frame = CGRectMake(WIDTH / 4, HEIGHT / 3 - HEIGHT / 3 / 15, WIDTH / 4 / 3, HEIGHT / 3 / 4);
    _userButton.frame = CGRectMake(WIDTH / 8 * 3, HEIGHT / 3 / 2, WIDTH / 4, WIDTH / 4);
    _setUpButton.frame = CGRectMake(WIDTH / 4 * 3 - WIDTH / 3 / 4, HEIGHT / 3 - HEIGHT / 3 / 15 * 2, WIDTH / 4 / 3, WIDTH / 3 / 4);
    _telephoneLabel.frame = CGRectMake(WIDTH / 4 + WIDTH / 4 / 3, HEIGHT / 2, WIDTH / 2, HEIGHT / 3 / 4);
    _positionImgView.frame = CGRectMake(WIDTH / 8 * 3, HEIGHT / 2 + HEIGHT / 11, WIDTH / 4 / 3 / 3, HEIGHT / 3 / 6);
    _positionLabel.frame = CGRectMake(WIDTH / 8 * 3 + WIDTH / 4 / 3 / 2, HEIGHT / 2 + HEIGHT / 12, WIDTH / 4, HEIGHT / 3 / 4);
    _lineLabel.frame = CGRectMake(10, HEIGHT / 4 * 3, WIDTH - 20, 1);
    _lineLabel2.frame = CGRectMake(10 + (WIDTH - 20) / 3, HEIGHT / 4 * 3, 1, (HEIGHT - 20) / 4);
    _lineLabel3.frame = CGRectMake(10 + (WIDTH - 20) / 3 * 2, HEIGHT / 4 * 3, 1, (HEIGHT - 20) / 4);
    _orderButton.frame = CGRectMake(10, HEIGHT / 4 * 3, (WIDTH - 20) / 3, (HEIGHT - 20) / 4);
    _livingButton.frame = CGRectMake(10 + (WIDTH - 20) / 3, HEIGHT / 4 * 3, (WIDTH - 20) / 3, (HEIGHT - 20) / 4);
    _renovateButton.frame = CGRectMake(10 + (WIDTH - 20) / 3 * 2, HEIGHT / 4 * 3, (WIDTH - 20) / 3, (HEIGHT - 20) / 4);
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
